﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace mysix
{
    public partial class Form3 : Form
    {
        string myvalue = "";
        public Form3(string myvalue)
        {
            InitializeComponent();
            this.myvalue = myvalue;
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string s1 = textBox1.Text;
            string s2 = textBox2.Text;
            string s3 = textBox3.Text;
            ClassDB myclass = new ClassDB();

            if (myvalue == "Add")
            {
                myclass.AddClass(int.Parse(s1), int.Parse(s2), s3);
                dbmanager mydb = new dbmanager();
                mydb.AddLog("Class", "Add", "新增了ClassId为" + s2 + "的班级");
            }
            if (myvalue == "Update")
            {
                myclass.UpdateClass(int.Parse(s1), int.Parse(s2), s3);
                dbmanager mydb = new dbmanager();
                mydb.AddLog("Class", "Update", "更新了ClassId为" + s2 + "的班级");
            }
            this.Close();
        }
    }
}
